package cn.uestc.labhms.modules.hms.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import cn.uestc.labhms.modules.hms.entity.InspectIndictorExplainEntity;
import cn.uestc.labhms.modules.hms.service.InspectIndictorExplainService;
import cn.uestc.labhms.common.utils.PageUtils;
import cn.uestc.labhms.common.utils.R;



/**
 * 
 *
 * @author Mu.tz
 * @email Mutz@gmail.com
 * @date 2021-11-01 20:33:41
 */
@RestController
@RequestMapping("hms/inspectindictorexplain")
public class InspectIndictorExplainController {
    @Autowired
    private InspectIndictorExplainService inspectIndictorExplainService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("hms:inspectindictorexplain:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = inspectIndictorExplainService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{inspectItemId}")
    @RequiresPermissions("hms:inspectindictorexplain:info")
    public R info(@PathVariable("inspectItemId") String inspectItemId){
		InspectIndictorExplainEntity inspectIndictorExplain = inspectIndictorExplainService.getById(inspectItemId);

        return R.ok().put("inspectIndictorExplain", inspectIndictorExplain);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("hms:inspectindictorexplain:save")
    public R save(@RequestBody InspectIndictorExplainEntity inspectIndictorExplain){
		inspectIndictorExplainService.save(inspectIndictorExplain);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("hms:inspectindictorexplain:update")
    public R update(@RequestBody InspectIndictorExplainEntity inspectIndictorExplain){
		inspectIndictorExplainService.updateById(inspectIndictorExplain);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("hms:inspectindictorexplain:delete")
    public R delete(@RequestBody String[] inspectItemIds){
		inspectIndictorExplainService.removeByIds(Arrays.asList(inspectItemIds));

        return R.ok();
    }

}
